public class TreeNode<E> {
	private Integer key; // key of the node
	private E element; // element of the node
	private TreeNode<E> left; // left child of node
	private TreeNode<E> right; // right child of node

	/** Constructor */
	public TreeNode() {
		left = right = null;
	}

	public TreeNode(Integer k, E val) {
		left = right = null;
		key = k;
		element = val;
	}

	public TreeNode(Integer k, E val, TreeNode<E> l, TreeNode<E> r) {
		left = l;
		right = r;
		key = k;
		element = val;
	}

	/** get and set the key value */
	public Integer key() {
		return key;
	}

	public void setKey(Integer k) {
		key = k;
	}

	/** get and set the element value */
	public E element() {
		return element;
	}

	public void setElement(E v) {
		element = v;
	}

	/** get and set the left child */
	public TreeNode<E> left() {
		return left;
	}

	public void setLeft(TreeNode<E> p) {
		left = p;
	}

	/** get and set the right child */
	public TreeNode<E> right() {
		return right;
	}

	public void setRight(TreeNode<E> p) {
		right = p;
	}
}
